#ifndef _BUILDABLE_H
#define _BUILDABLE_H

#include <list>
#include "common.h"

class Tile;

class Buildable
{
public:
    Buildable();
    virtual ~Buildable(){;}

    virtual void eventHandle(sf::Event event);
    virtual void inputHandle();
    virtual void update(double dt);

    void onPlace();
    virtual void onBuild(){;}
    virtual void onDestroy(){;}

    sf::Sprite* getSprite(){return &sprite;}
    void        setSprite(String filename);

    int  getCost(){return cost;}
    void setCost(int amt){this->cost = amt;}

    sf::Vector2i getOrigin(){return origin;}
    void         setOrigin(sf::Vector2i coords){origin = coords;}

public:
    enum Type
    {
        RESIDENTIAL,
        COMMERCIAL,
        INDUSTRIAL,
        ROAD,
        RAIL,
        POWER_LINE,
        POWER_PLANT,
        CIVIC
    };

    Buildable::Type getType(){return type;}

    enum Density
    {
        DENSITY_LOW,
        DENSITY_MEDIUM,
        DENSITY_HIGH
    };

    Density getDensity(){return density;}
    void    setDensity(Density d){density = d;}

private:
    sf::Sprite sprite;
    int cost;
    Type type;
    Density density;

    sf::Vector2i origin;
    std::list<Tile*> foundation;

};

#endif
